package com.javafactroy.kunlong.bip.icp.message.test.base;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import lombok.Data;
import lombok.ToString;
import com.javafactroy.kunlong.bip.icp.message.dxp.iface.IMsgHeader;

@Data
@ToString
public class TMsgResp extends TMsg {
    public TMsgResp() {
        super();
        super.header.setType(IMsgHeader.TYPE_RESP);
    }

    public static TMsgResp buildMessage() {
        return new TMsgResp();


    }

    public static TMsgResp buildDefault() {
        TMsgResp rsp = new TMsgResp();

        rsp.getHeader().setState(20);
        return rsp;
    }

    public static TMsgResp buildMsgError() {
        TMsgResp rsp = new TMsgResp();
        TMsgHeader header = new TMsgHeader();

        rsp.setHeader(header);
        TMsgBody mb = new TMsgBody();
        rsp.setBody(mb);

        return rsp;
    }

    public String toJSONString() {
        return JSON.toJSONString(this, SerializerFeature.PrettyFormat);
    }
}
